From 24bba4cc56db7a75569063a0bdc09bffb0e21da5 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 22 Mar 2011 14:51:06 -0400 Subject: [PATCH] gtksettings: unset attributes set to normal from font description So that they do not override values coming from the theme. Based on a patch by Carlos Garnacho. https://bugzilla.gnome.org/show_bug.cgi?id=645458 --- gtk/gtksettings.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 3a834406b4..259960707c 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -1345,6 +1345,24 @@ gtk_settings_get_style (GtkStyleProvider *provider, font_desc = pango_font_description_from_string (font_name); + /* Unset normal attributes from this description, + * so they do not override theme values */ + if (pango_font_description_get_weight (font_desc) == PANGO_WEIGHT_NORMAL) + pango_font_description_unset_fields (font_desc, + PANGO_FONT_MASK_WEIGHT); + + if (pango_font_description_get_stretch (font_desc) == PANGO_STRETCH_NORMAL) + pango_font_description_unset_fields (font_desc, + PANGO_FONT_MASK_STRETCH); + + if (pango_font_description_get_variant (font_desc) == PANGO_VARIANT_NORMAL) + pango_font_description_unset_fields (font_desc, + PANGO_FONT_MASK_VARIANT); + + if (pango_font_description_get_style (font_desc) == PANGO_STYLE_NORMAL) + pango_font_description_unset_fields (font_desc, + PANGO_FONT_MASK_STYLE); + gtk_style_properties_set (props, 0, "font", font_desc, NULL); -- 2.30.2